import axios from "../utils/http";

const AdminStore = {
    namespaced: true,
    state: () => ({
        admin_list: [],
        zongshu: 0
    }),
    mutations: {
        AdminMutations(state, list) {
            state.admin_list = list
        },
        AdminZong(state, list) {
            state.zongshu = list
        }
    },
    actions: {
        AdminActions(context, page={size :5, page : 1}) {
            var url = '/api/userlist?size=' + page.size + '&page=' + page.page
            axios.get(url).then(res => {
                if(res.code==200){
                    context.commit('AdminMutations', res.list)
                }
                
            })
        },
        AdminZongshu(context) {
            axios.get('/api/usercount').then(res => {
                if (res.code == 200) {
                    context.commit('AdminZong', res.list[0].total)
                }

            })
        }
    }
}

export default AdminStore